<?php

namespace App\Jobs;

use App\Models\Order;
use App\Services\CommonService;
use App\Services\ExceptionService;
use App\Services\RiskDlzwService;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;

class ProcessPodcast implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $podcast;
    public function __construct($podcast)
    {
        $this->podcast = $podcast;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {

        Log::Info("job开始");
        Log::Info($this->podcast);
        $order = Order::from('sp_order_2 as o')->where('o.id',$this->podcast)
            ->leftjoin('sp_member_2 as m','m.id','o.uid')
            ->select(
                'o.id','o.uid','o.mobile as user_mobile','o.pact_url_5','o.trade_no'
                ,'m.cert_name','m.cert_no','o.sale_user_id','o.prov','o.location','o.city','o.prov','o.area'
                ,'m.mobile','m.esign_user_id','m.esign_seal_id','m.user_id','m.idcard_front','m.idcard_back'
            )
            ->first();
        if(!empty($order['cert_no'])){
            RiskDlzwService::shopInquire($order);
            Log::Info("都来租风控查询成功");
        }
        Log::Info("job结束");
    }
}
